using System;
using System.ComponentModel;

namespace Edge.Common.TextTemplates.Impl.ASPNET
{
    public class Site : ISite
    {
        private IServiceProvider serviceProvider;

        public Site(IServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
        }

        ///<summary>
        ///Gets the component associated with the <see cref="T:System.ComponentModel.ISite"></see> when implemented by a class.
        ///</summary>
        ///
        ///<returns>
        ///The <see cref="T:System.ComponentModel.IComponent"></see> instance associated with the <see cref="T:System.ComponentModel.ISite"></see>.
        ///</returns>
        ///
        public IComponent Component
        {
            get { throw new NotImplementedException(); }
        }

        ///<summary>
        ///Gets the <see cref="T:System.ComponentModel.IContainer"></see> associated with the <see cref="T:System.ComponentModel.ISite"></see> when implemented by a class.
        ///</summary>
        ///
        ///<returns>
        ///The <see cref="T:System.ComponentModel.IContainer"></see> instance associated with the <see cref="T:System.ComponentModel.ISite"></see>.
        ///</returns>
        ///
        public IContainer Container
        {
            get { throw new NotImplementedException(); }
        }

        ///<summary>
        ///Determines whether the component is in design mode when implemented by a class.
        ///</summary>
        ///
        ///<returns>
        ///true if the component is in design mode; otherwise, false.
        ///</returns>
        ///
        public bool DesignMode
        {
            get { return false; }
        }

        #region ISite Members

        ///<summary>
        ///Gets or sets the name of the component associated with the <see cref="T:System.ComponentModel.ISite"></see> when implemented by a class.
        ///</summary>
        ///
        ///<returns>
        ///The name of the component associated with the <see cref="T:System.ComponentModel.ISite"></see>; or null, if no name is assigned to the component.
        ///</returns>
        ///
        public string Name
        {
            get { return "TextTemplates Engine"; }
            set { throw new NotImplementedException(); }
        }

        #endregion

        #region IServiceProvider Members

        ///<summary>
        ///Gets the service object of the specified type.
        ///</summary>
        ///
        ///<returns>
        ///A service object of type serviceType.-or- null if there is no service object of type serviceType.
        ///</returns>
        ///
        ///<param name="serviceType">An object that specifies the type of service object to get. </param><filterpriority>2</filterpriority>
        public object GetService(Type serviceType)
        {
            if (serviceProvider == null)
                return null;

            return serviceProvider.GetService(serviceType);
        }

        #endregion
    }
}